program example
use polymorphic_complextaylor
implicit none 
integer no,nv
complex(dp) c,cc
type(complextaylor) f,g


no=4; nv=3;    ! no: the order of the polynomial    nv: the number of variables
call init(no,nv)  ! initializes taylor series without maps

call alloc(f,g)      ! must be constructed after init


c=cmplx(5.d0,-1.4d0,kind=dp)
cc=cmplx(6.d0,1.6d0,kind=dp)  


f=(c.mono.'12') + (cc.mono.'11') + 4.d0 
   !  Creates (5.d0 x_1 x_ 2 ^2 - 1.4d0 i* x_1 x_ 2 ^2) + (6.d0 x_1x_2 + 1.6d0 i* x_1x_2) +4.d0
g=f.k.1       !     Creates (5.d0 x_2^2- 1.4d0 i* x_ 2 ^2) + (6.d0 x_2 + 1.6d0 i* x_2)

call print(f,6)
call print(g,6)



f=(c.mono.'121') + (cc.mono.'103') + 4.d0 
   !  Creates (5.d0 x_1 x_ 2^2 x_3 -1.4d0 i* x_1 x_ 2^2 x_3) + (6.d0 x_1x_3^3 + 1.6d0 i* x_1x_3^3) +4.d0
g=f.k.2       !     Creates (5.d0x_1 x_2  x_3 -1.4d0 i* x_1 x_ 2 x_3)

call print(f,6)
call print(g,6)



call kill(f,g)      ! must be destroyed
end program example